﻿using Mrsoft.Common;
using System;
using System.Xml.Linq;
using System.Xml.XPath;
using MuYue.Common;
using Mrsoft.Core;

namespace Mrsoft.UI
{
    public static class LoginResult
    {
        private static bool _Login;
        private static string _Key;
        private static string _failReason;

        public static string FailReason {
            get { return LoginResult._failReason; }
        }

        public static void Set(string url, string user, string pass) {
            APIJsonObject api = MuYue.Http.WebEngine.JsonApi<APIJsonObject>(url);
            _Login = api.state;
            _Key = api.RegKey;
            _failReason = api.message;
        }

        public static bool Login {
            get {
                return !string.IsNullOrEmpty(_Key) && _Login;
            }
        }
    }
}
